#include <cstdio>
#include <algorithm>
using namespace std;
int num[20005];
int main()
{
	freopen("in.txt","r",stdin);
	int n,b;
	scanf("%d %d",&n,&b);
	for(int i = 0; i < n; i++)
	{
		scanf("%d",&num[i]);
	}
	sort(num,num+n);
	int i = n-1;
	int sum = 0;
	while(sum < b)
	{
		sum += num[i];
		i--;
	}
	printf("%d",n-i-1);
	return 0;
}
